﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <!-- Global Defaults -->
    <Style TargetType="{x:Type ButtonBase}"
           BasedOn="{StaticResource {x:Type ButtonBase}}">
        <Setter Property="MinHeight"
                Value="24" />
        <Setter Property="MinWidth"
                Value="80" />
    </Style>

    <!-- Flat Button -->
    <Style x:Key="FlatButton"
           TargetType="{x:Type ButtonBase}">
        <Setter Property="Background"
                Value="{DynamicResource FlatButtonHoverBackgroundBrush}" />
        <Setter Property="BorderBrush"
                Value="{DynamicResource FlatButtonHoverBorderBrush}" />
        <Setter Property="Foreground"
                Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="HorizontalContentAlignment"
                Value="Center" />
        <Setter Property="VerticalContentAlignment"
                Value="Center" />
        <Setter Property="Padding"
                Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ButtonBase}">
                    <Grid>
                        <Border x:Name="border"
                                Margin="0"
                                BorderThickness="1"
                                CornerRadius="2"
                                Background="Transparent"
                                BorderBrush="Transparent">
                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              Margin="{TemplateBinding Padding}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                              RecognizesAccessKey="True" />
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver"
                                 Value="True">
                            <Setter Property="Background"
                                    TargetName="border"
                                    Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Background}" />
                            <Setter Property="BorderBrush"
                                    TargetName="border"
                                    Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderBrush}" />
                        </Trigger>
                        <Trigger Property="IsKeyboardFocused"
                                 Value="true" />
                        <Trigger Property="ToggleButton.IsChecked"
                                 Value="true" />
                        <Trigger Property="IsEnabled"
                                 Value="false">
                            <Setter Property="Foreground"
                                    Value="{DynamicResource FlatButtonDisabledForegroundBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- DockPane button style -->
    <Style x:Key="DockPaneButton"
           TargetType="{x:Type ButtonBase}"
           BasedOn="{StaticResource FlatButton}">
        <Setter Property="Background"
                Value="{DynamicResource DockPaneHoverBackgroundBrush}" />
        <Setter Property="BorderBrush"
                Value="Transparent" />
    </Style>

</ResourceDictionary>